
<%@page import="cn.com.dhcc.app.core.CoreEnv.CoreInitCtx"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>${appname}</title>
<%@ include file="/WEB-INF/view/common/css_js_ace.jsp"%>

<script type="text/javaScript" src="${ctx}/static/js/jquery.selectlistactions.js"></script>
<script type="text/javaScript" src="${ctx}/static/js/jquery.floatThead.min.js"></script>
    <style>
        .hidden_div{
            display: none;
        }

    </style>
<!-- 必要的js文件 end -->
<script type="text/javascript">
	var num = 0;
	var modal = null;
	var tableInfoModal = null;
	var whereConditionModal = null;
	var tabs = [];
	var tableNames="";
	var tablesJson;
	var flag = false;
	var isExit=true;
	var taskType = '${taskType}';
	var tableList = []; //所有选中表
	var tableSelected = [];
	var icTableList = [];//所有有增量字段的选中表
	var tableCount = 0;
	
	$(document).ready(function() {
		//changeTableSize();
		$('#btnRight').click(function(e) {
			var tables = [];

			$('#source').find("option:selected").each(function() {
				var table = {};
				table.tableId = $(this).val();
				table.tableName = $(this).text();
				table.tableType = $(this).attr("tableType");
				table.schema = $(this).attr("tableschema");
				tables.push(table);
			});

			$('select').moveToListAndDelete('#source', '#destination');
			deselectOptions();
			disableButtons();

			showTables(tables);
			changeTitles();
			e.preventDefault();
		});

		$('#btnAllRight').click(function (e) {
			var tables = [];

			$('#source').find("option").each(function() {
				var table = {};
				table.tableId = $(this).val();
				table.tableName = $(this).text();
				table.tableType = $(this).attr("tableType");
				table.schema = $(this).attr("tableschema");
				tables.push(table);
			});
			
		  $('select').moveAllToListAndDelete('#source', '#destination');
		  deselectOptions();
		  disableButtons();
		  showTables(tables);
		  changeTitles();
		  e.preventDefault();
		});

		$('#btnLeft').click(function(e) {
 			var ids = [];
			
			$('#destination').find("option:selected").each(function() {
				ids.push($(this).val());
			});

			deleteFromTable(ids);
			
			$('select').moveToListAndDelete('#destination', '#source');
			deselectOptions();
			disableButtons();
			changeTitles();
			e.preventDefault();
		});

		$('#btnAllLeft').click(function (e) {
			var ids = [];
			
			$('#destination').find("option").each(function() {
				ids.push($(this).val());
			});

			deleteFromTable(ids);
			
		  $('select').moveAllToListAndDelete('#destination', '#source');
		  deselectOptions();
		  disableButtons();
		  changeTitles();
		  e.preventDefault();
		});

		//搜索框
		//$('#source').filterByText($('#filter_source'), true);
		//$('#destination').filterByText($('#filter_destination'), true);

		$('#source').on('change', '', function(e) {
			var len = $('#source').find("option:selected").length;
			if (len != 0) {
				$('#btnRight').attr("disabled", false);
			} else {
				$('#btnRight').attr("disabled", true);
			}
		});

		$('#destination').on('change', '', function(e) {
			var len = $('#destination').find("option:selected").length;
			if (len != 0) {
				$('#btnLeft').attr("disabled", false);
			} else {
				$('#btnLeft').attr("disabled", true);
			}
		});

		fixedHeadTable();
		
		$("#ds_mapping").on('change', '', function(e) {
            $("#conf_1").css("display", "none");
            $("#conf_3").css("display", "none");
            $("#settSpan").css("display", "none");
            $("#isSett").prop("checked",false);
            if(this.value != ''){
                var mptype = $(this.selectedOptions).attr("mptype");
                $("#conf_"+mptype).css("display", "");
                if(mptype == 1){
                    $("#settSpan").css("display", "");
                    changeTable(this.value);
                }
            }
        });
//        $("input[name='filterType']").click(function() {
//            var filterType = $("input[name='filterType']:checked").val();
//            alert(filterType);
//            $("#filterValue"+filterType).attr("datatype","require");
//            $("#filterValue"+filterType).attr("msg","输入通配符");
//        });
	})
	
	function fixedHeadTable() {
		var $table = $('.wrapper table');

	      $table.floatThead({
	        //useAbsolutePositioning: true,
	        scrollContainer: function($table) {
	          return $table.closest('.wrapper');
	        }
	      });
	}
	
	function deselectOptions() {
		$('#destination').find("option:selected").each(function() {
			$(this).prop("selected", false);
		});
		
		$('#source').find("option:selected").each(function() {
			$(this).prop("selected", false);
		});
	}

	function showTables(tables) {
		tableList = tables;
		var tbody = "";
		for (var count = 0; count < tables.length; count++) {
			var isIc = "无";
			var intervalCell = "-";
			var tableNum = tableCount + count;
			if(tables[count].tableType == '1') {
				isIc = "有";
				intervalCell = "<div class='visible-md visible-lg hidden-sm hidden-xs action-buttons'>"
					        +  "<input class='endValue' type='hidden' name='tables["+tableNum+"].endValue'>"
							+  "<input class='startValue' type='hidden' name='tables["+tableNum+"].startValue'>"
							+  "<a class='blue' tableId="
							+  tables[count].tableId
							+  " onclick='showInterval(this)' title='查看'>"
							+  "<i class='icon-zoom-in bigger-130'></i>"
							+  "</a>"
							+  "<a class='blue' tableId="
							+  tables[count].tableId
							+  " onclick='editInterval(this)' title='修改'>"
							+  "<i class='icon-pencil bigger-130'></i>"
							+  "</a>"
							+  "</div>";
				icTableList.push(tables[count]);
			}
			
			tbody += "<tr id=" + tables[count].tableId + ">"
					+ "<td class='center' width='5%'>"
					+ "<label>"
					+ "<input type='checkbox' class='ace' onclick='changeDestination(this);' value='" + tables[count].tableId + "'/>"
					+ "<span class='lbl'></span>"
					+ "</label>"
					+ "</td>"
					+ "<td class='center table_name' width='25%'>"
					+ "<input type='hidden' name='tables["+tableNum+"].tableId' value=" + tables[count].tableId + ">"
					+ "<input type='hidden' name='tables["+tableNum+"].tabOrder' value=" + count + tableCount + ">"
					+ tables[count].tableName
					+ "</td>"
					+ "<td class='center' width='15%'>"
					+ tables[count].schema
					+ "</td>"
					+ "<td class='center' width='13%'>"
					+ isIc
					+ "</td>"
					+ "<td class='center' width='13%'>"
					+ "<div class='visible-md visible-lg hidden-sm hidden-xs action-buttons'>"
					+  "<a class='blue' tableId="
					+  tables[count].tableId
					+  " onclick='showColInfo(this)' title='查看'>"
					+  "<i class='icon-zoom-in bigger-130'></i>"
					+  "</a>"
					+  "</div>"
					+ "</td>"
					+ "<td class='center' width='13%'>"
					+ intervalCell
					+ "</td>"
					+ "<td class='center' width='16%'>"
					+ "<div class='visible-md visible-lg hidden-sm hidden-xs action-buttons'>"
			        +  "<input class='WhereCondition' type='hidden' name='tables["+tableNum+"].whereCondition'>"
					+  "<a class='blue' tableId="
					+  tables[count].tableId
					+  " onclick='showWhereCondition(this)' title='查看'>"
					+  "<i class='icon-zoom-in bigger-130'></i>"
					+  "</a>"
					+  "<a class='blue' tableId="
					+  tables[count].tableId
					+  " onclick='editWhereCondition(this)' title='修改'>"
					+  "<i class='icon-pencil bigger-130'></i>"
					+  "</a>"
					+  "</div>"
					+ "</td>" + "</tr>";
		}

		tableCount += tables.length;
		$('#table_table_body').append(tbody);
		tableSelected = tables;
		parent.$("#tableSelectModal").modal("hide");
	}
	
	function deleteFromTable(ids) {
		for (var i = 0; i < ids.length; i++) {
			$('#' + ids[i]).remove();
		}
	
		var newTableSelected = [];
		
		for(var i = 0; i<tableSelected.length; i++) {
			var tabId = tableSelected[i].tableId;
			if($.inArray(tabId, ids) == -1) {
				newTableSelected.push(tableSelected[i]);
			}
		}
		
		var tempCount = tableCount - ids.length;
		tableCount = 0;
		$('#table_table_body').html("");
		showTables(newTableSelected);
		tableCount = tempCount;
		
	}
	
	function disableButtons() {

		var lengthOfLeftSelected = $('#source').find("option:selected").length;
		var lengthOfRightSelected = $('#destination').find("option:selected").length;
		var lengthOfLeft = $('#source').children('option').length;
		var lengthOfRight = $('#destination').children('option').length;

		if (lengthOfLeftSelected != 0) {
			$('#btnRight').attr("disabled", false);
		} else {
			$('#btnRight').attr("disabled", true);
		}

		if (lengthOfRightSelected != 0) {
			$('#btnLeft').attr("disabled", false);
		} else {
			$('#btnLeft').attr("disabled", true);
		}

		if(lengthOfLeft == 0) {
			$('#btnAllRight').attr("disabled", true);
		} else {
			$('#btnAllRight').attr("disabled", false);
		}
		
		if(lengthOfRight == 0) {
			$('#btnAllLeft').attr("disabled", true);
		} else {
			$('#btnAllLeft').attr("disabled", false);
		}
		
		if(lengthOfRight == 0) {
			$('#select_finish_btn').attr("disabled", true);
		} else {
			$('#select_finish_btn').attr("disabled", false);
		}
	}
	
	function changeDomain(value) {
		var tableURL = _ctx + "/task/change_domain.do?domainId=" + value;
		$.jsonAjaxSelect("dc_select", tableURL, "id", "name", false);
	}

	function changeTable(value) {
		$(".dual_select").find('option').remove();
		//var tableURL = _ctx + "/task/change_table.do?dsMappingId=" + value;
		//$.jsonAjaxSelect("table_select", tableURL, "id", "name", false);
		
		$.ajax({
			type : "GET",
			dataType : "json",
			cache : false,
			url : _ctx + "/task/change_table.do",
			asyn: false,
			data : {
				dsMappingId : value,
			},
			success : function(resp) {
				if (resp.status == '1') {
					var tabs = resp.data;
					for (var count = 0; count < tabs.length; count++) {
						var id = tabs[count].id;
						var name = tabs[count].tableName;
						var tableType = tabs[count].tableType;
						
						var option = "<option value='"+tabs[count].id+"' tableType='"+ tabs[count].tableType +"' tableSchema='" + tabs[count].schema+" '>"+tabs[count].tableName + "</option>";
						$('#source').append($(option));
					}
					
				} else {
					 parent.ui.msg(resp.msg, 0);
				}
				
			},
			error : function() {
				ui.msg('信息加载错误', 0);
			}
		}).done(function() {
			disableButtons();
			
			$('#table_table_body').empty();
			changeTitles();
		});

	}
	
	function changeDestination(obj) {
		if($(obj).attr("id") == "checkedAll") {
			$('#destination').find('option').each(function() {
				if($(obj).is(':checked')) {
					$(this).prop('selected','selected');
				} else {
					$(this).prop('selected',false);
				}
			});
		} else {
			var id = $(obj).attr("value");
			if($(obj).is(':checked')) {
				$('#destination option[value="' + id + '"]').prop('selected','selected');
			} else {
				$('#destination option[value="' + id + '"]').prop('selected',false);
			}
		}
		
		disableButtons();
		
	}
	
	function changeTitles() {
		var sourceNum = $('#source').find('option').length;
		var destNum = $('#table_table_body').find('tr').length;
		var sourceTitle = "源端数据对象列表（共" + sourceNum + "）";
		var destTitle = "已选择抽取对象（共" + destNum + "）";
		
		$('#source_title').html(sourceTitle);
		$('#dest_title').html(destTitle);
	}
	
	function changeTableSize() {
		// Change the selector if needed
		var $table = $('table.scroll'),
		    $bodyCells = $table.find('tbody tr:first').children(),
		    colWidth;

		// Adjust the width of thead cells when window resizes
		$(window).resize(function() {
		    // Get the tbody columns width array
		    colWidth = $bodyCells.map(function() {
		        return $(this).width();
		    }).get();
		    
		    // Set the width of thead columns
		    $table.find('thead tr').children().each(function(i, v) {
		        $(v).width(colWidth[i]);
		    });    
		}).resize(); // Trigger resize handler
	}

	function showColInfo(obj) {
		var id = $(obj).attr("tableId");
		$.ajax({
			type : "POST",
			dataType : "html",
			cache : false,
			url : _ctx + "/task/get_table_col.do",
			data : {
				tableId : id,
			},
			success : function(content) {
				$("#tableDiv").html(content);
				var hiddenByClick = false;
				window.parent.iframeModal("tableModal", $("#tempDiv").html(),
						hiddenByClick);
			},
			error : function() {
				ui.msg('信息加载错误', 0);
			}
		});
	}

	function showWhereCondition(obj) {
		//var id = $(obj).attr("tableId");
		
		$('#WhereCell').empty();
		var condition = $(obj).prev().val();
		$('#WhereCell').html(condition);
		var hiddenByClick = false;
		window.parent.iframeModal("tableModal", $("#WhereShowDiv").html(),
				hiddenByClick);
	}
	
	function showInterval(obj) {
		var id = $(obj).attr("tableId");
		
		$('#StartValueCell').empty();
		$('#StartValueCell').empty();
		
		var startValue = $(obj).prev().val();
		var endValue = $(obj).prev().prev().val();
		$('#StartValueCell').html(startValue);
		$('#EndValueCell').html(endValue);
		
		var hiddenByClick = false;
		window.parent.iframeModal("intervalShowModal", $("#IntervalShowDiv").html(),
				hiddenByClick);
	}

	function editWhereCondition(obj) {
		var id = $(obj).attr("tableId");
		var oldWhere = $(obj).prev().prev().val();
		var dsMappingId = $('#ds_mapping').val();
		$.ajax({
			type : "POST",
			dataType : "html",
			cache : false,
			url : _ctx + "/task/edit_where.do",
			data : {
				tableId : id,
				oldWhere: oldWhere,
				mappingId: dsMappingId
			},
			success : function(content) {
				$("#tableDiv_2").html(content);
				var hiddenByClick = false;
				window.parent.iframeModal("WhereEditModal", $("#WhereEditDiv").html(),
						hiddenByClick);
			},
			error : function() {
				parent.ui.msg('信息加载错误', 0);
			}
		});
	}
	
	function editInterval(obj) {
		var id = $(obj).attr("tableId");
		var oldStart = $(obj).prev().prev().val();
		var oldEnd = $(obj).prev().prev().prev().val();
		var executeType = taskType;
		
		$.ajax({
			type : "POST",
			dataType : "html",
			cache : false,
			url : _ctx + "/task/edit_interval.do",
			data : {
				tableId : id,
				oldStartValue: oldStart,
				oldEndValue: oldEnd,
				taskType: taskType
			},
			success : function(content) {
				$('#tableDiv_4').html(content);
				var hiddenByClick = false;
				window.parent.iframeModal("IntervalEditModal", $("#IntervalEditDiv").html(),
						hiddenByClick);
			},
			error : function() {
				parent.ui.msg('信息加载错误', 0);
			}
		});
	}

	function saveWhereEdit(obj, isAll) {
		var where_content = parent.$('#where_edit_field').val();
		
		//为其他表进行相同配置
		if(isAll) {
			for (var count = 0; count < tableList.length; count++) {
				var id = tableList[count].tableId;
				$('#' + id).find('input.WhereCondition').attr("value", where_content);
			}
		} else {
			var id = $(obj).attr("tableId");
			$('#' + id).find('input.WhereCondition').attr("value", where_content);
		}
		parent.$("#WhereEditModal").modal("hide");
	}
	
	function saveIntervalEdit(obj, isAll) {	
		var startValue = parent.$('#start_value').val();
		var endValue = parent.$('#end_value').val();
		
		//查看哪一个被显示
		if(isAll) {
			for (var count = 0; count < icTableList.length; count++) {
				var id = icTableList[count].tableId;
				$('#' + id).find('input.startValue').attr("value", startValue);
				$('#' + id).find('input.endValue').attr("value", endValue);
			}
			
		} else {
			var id = $(obj).attr("tableId");
			$('#' + id).find('input.startValue').attr("value", startValue);
			$('#' + id).find('input.endValue').attr("value", endValue);
		}
		
		parent.$("#IntervalEditModal").modal("hide");
	}

	function addTables() {
		var dsMappingId = $('#ds_mapping').val();
		if(dsMappingId == "" || dsMappingId == null) {
			alert("请选择数据源映射");
			return;
		}
		
		$.ajax({
			type : "POST",
			dataType : "html",
			cache : false,
			url : _ctx + "/task/select_table.do",
			data : {
				dsMappingId: dsMappingId
			},
			success : function(content) {
				$("#tableDiv_3").html(content);
				var hiddenByClick = false;
				window.parent.iframeModal("tableSelectModal", $("#selectModalDiv").html(),
						hiddenByClick);
			},
			error : function() {
				parent.ui.msg('信息加载错误', 0);
			}
		});
	}
	
	$(function() {
		$(window).bind('beforeunload', function() {
			if (isExit) {
				return '您输入的内容尚未保存，确定离开此页面吗？';
			}
		});
		$('.tipMe').tooltip({
			'placement' : 'top'
		});
		//$('#inputForm input').tooltip({'placement':'top'});
		$('#inputForm input').tooltip();
		//表单验证
		$('#inputForm').checkForm(sub);
		$('#inputForm').ajaxForm({
			url : _ctx + "/task/add_task.do",
			type : "post",
			dataType : "json",
			beforeSubmit : function() {
				$("#sbmBtn").attr("disabled", "disabled");
			},
			clearForm : false,
			resetForm : false,
			success : function(resp) {
				if (resp.status == '1') {
					isExit = false;
					parent.ui.msg(resp.msg, 1);
					ui.go(_ctx + '/task/task_list.do');
				} else {
					parent.ui.msg(resp.msg, 0);
				}
				$("#sbmBtn").removeClass("disabled").attr("disabled", null);
			},
			error : function(resp) {
				parent.ui.msg('请求发送失败', 0);
				$("#sbmBtn").removeClass("disabled").attr("disabled", null);
			}
		});

		changeTaskType(taskType);
	});

	var sqlTestFlag = 1;

	function sub() {
		//检查发送频率设置
		if (taskType == 2) {//检查周期性任务设置
			var freq = $("input[name='freq']:checked").val();
			var intervalVallue;
			var executeTime;
			if (freq == 1) {
				if ($("#intervalVallue1").val() == ''
						|| $("#intervalVallue1").val() == null) {
					alert("间隔时间不能空");
					return false;
				}
				intervalVallue = $("#intervalVallue1").val()
						* $("#intervalVallue1Type").val();
			} else {
				if ($("#executeTime" + freq).val() == null
						|| $("#executeTime" + freq).val() == '') {
					alert("执行时间不能为空");
					return false;
				}
				executeTime = $("#executeTime" + freq).val();
				intervalVallue = $("#intervalVallue" + freq).val();
				$("#periodExecuteTime").val(executeTime);
			}
			$("#intervalVallue").val(intervalVallue);
			$("#extrEndTime").val("");
		}
		
		//检查定时发送时间
		if ($("input[name='executeType']:checked").val() == 3) {
			if ($("#ontimeExecuteTime").val() == ''
					|| $("#ontimeExecuteTime").val() == null) {
				alert("定时发送时间不能为空");
				return false;
			}
		}

		//检查截止时间
		if ($("input[name='cutOffTimeType']:checked").val() == 1) {
			$("#cutOffTime").val("");
		} else {
			if ($("#cutOffTime").val() == "" || $("#cutOffTime").val() == null) {
				alert("截止时间不能空");
				return false;
			}
		}

		//检查是否有发送表

		var dm = $("#ds_mapping")[0];
        var mptype = $(dm.selectedOptions).attr("mptype")
        if(mptype == 1){
            if ($('#table_table_body').children('tr').length == 0) {
//                alert('请选择发送表!');
                parent.ui.msg("请选择发送表", 0);
                return false;
            }
        }else if(mptype == 3){
            var filterType = $("input:radio[name='filterType']:checked").val();
            var filterValue = $("#filterValue"+filterType).val();

            if(filterValue == ""){
                alert("请输入过滤条件");
//                parent.ui.msg("请输入过滤条件", 0);
                return false;
            }
            $("#filterValue").val(filterValue);
            var maxType = $("input[name='maxType']:checked").val();
            if(maxType == 1){
                $("#sizeMax").val("");
            }
        }

	}

	function changeTaskType(taskType) {
		if(taskType == "1") {
			$('#freq_div').hide();
		}
	}
	function changeCutOffTimeType(idx) {
		if (idx == 1) {
			$("#cutOffTime").attr("disabled", "disabled");
		} else {
			$("#cutOffTime").removeClass("disabled").attr("disabled", null);
		}
	}
	function changeExecuteType() {
		if ($("input[name='executeType']:checked").val() == 3) {
			$("#ontimeExecuteTime").removeClass("disabled").attr("disabled",
					null);
		} else {
			$("#ontimeExecuteTime").attr("disabled", "disabled");
		}
	}
	function tableSqlTest(submitFlag) {
		var sql = $("#tableName").val() + " " + $("#whereCondition").val();
		$.ajax({
			type : "POST",
			url : _ctx + "/task/table_sql_test.do",
			async : false,
			cache : false,
			data : {
				dsId : $("#dsId").val(),
				schema : $("#schemaName").val(),
				testSql : sql,
				dsUsername : $("#dsUsername").val(),
				dsPasswd : $("#dsPasswd").val()
			},
			beforeSend : function() {
				$("#testSqlBtn").val("正在验证...").attr("disabled", "disabled");
			},
			success : function(data) {
				if (data.status == 0) {
					alert(data.msg);
					if (submitFlag) {
						sqlTestFlag = 0;
					}
				} else {
					if (submitFlag) {
						sqlTestFlag = 1;
					} else {
						alert(data.msg);
					}
				}
				$("#testSqlBtn").val("验证发布信息").attr("disabled", null);
			},
			error : function() {
				alert('系统异常,操作失败');
				$("#testSqlBtn").val("验证发布信息").attr("disabled", null);
			}
		});
	}
    function checkIsSett(){
        if($("#freq1").is(':checked')){
            if($("#intervalVallue1").val() == '' || $("#intervalVallue1").val() == null){
                alert("间隔时间不能空");
                $("#isSett").prop("checked",false);
            }
            var intervalVallue = $("#intervalVallue1").val()*$("#intervalVallue1Type").val();
            if(intervalVallue>60*60*12){
                alert("结算功能只能用于小于间隔12小时的周期性任务.");
                $("#isSett").prop("checked",false);
            }
        }else{
            alert("结算功能只能用于小于间隔12小时的周期性任务.");
            $("#isSett").prop("checked",false);
        }
    }
</script>

</head>
<body style="overflow-y: hidden;">
	<div class="main-container" id="main-container">
		<div class="main-container-inner">
			<div class="main-content" style="margin-left: 0px;">
				<div class="breadcrumbs" id="breadcrumbs">
					<ul class="breadcrumb">
						<li><i class="icon-home home-icon"></i> 首页</li>
						<li>ETL任务管理 </li>
						<c:choose> 
							<c:when test="${taskType eq 1}"><li>添加一次性任务 </li></c:when>
							<c:otherwise><li>添加周期性任务 </li></c:otherwise>
						</c:choose>
						
					</ul>
				</div>
				<div class="page-content">
					<div class="row">
						<div class="col-xs-12">
							<div class="widget-main">
								<div class="widget-box" style="border-bottom:0;">
									<div class="widget-header widget-header-flat">
										<div class="widget-toolbar no-border">
											<a class="btn btn-primary btn-xs"
												href="${ctx}/task/task_list.do"><i
												class="icon-arrow-left"></i> 返回&nbsp;&nbsp;</a>
										</div>
									</div>
									<form class="form-horizontal" role="form" id="inputForm" action="" method="post">
										<div class="widget-box transparent">
											<div class="widget-header">
												<h6 class="lighter blue">基本信息配置</h6>
											</div>
											
											<div class="widget-body">
												<div class="widget-main no-padding-left no-padding-right">	
													<div class="row">
														<div class="table-responsive">
															<div class="row">
																<div class="col-xs-12">
																	<div class="widget-main">
																		<div class="profile-user-info profile-user-info-striped" id="taskInfo">
																			<div class="profile-info-row" style="height: 45px;">
																				<div class="profile-info-name"style="padding-top: 15px;">
																					任务名称
																				</div>
																				<div class="profile-info-value">
																					<span class="editable"> 
																					<input type="text" class="col-xs-10 col-sm-3" name="taskName" id="taskName" style="width:35%;"
																						datatype="require|ajax|safeString2"  url="${ctx }/task/is_taskName_unique.do"  oldValue=""
																						title="必填项,任务名称" placeholder="请输入任务名称" msg="请输入任务名称|任务名称重复|不允许输入特殊字符"/> 
																					<span class="lbl">&nbsp;</span> </span>
																				</div>
																			</div>
																			<div class="profile-info-row" style="height: 45px;">
																				<div class="profile-info-name"
																					style="padding-top: 15px;">所属数据分类</div>
																				<div class="profile-info-value">
																					<span class="editable">
																						<select id="domain" name="domain" class="col-xs-8 col-sm-2" datatype="require" msg="选择业务域" onchange="changeDomain(this.value);">
																							<option value="">-请选择业务域-</option>
																							<c:forEach var="domain" items="${domains}">
																								<option value="${domain.id}">${domain.name}</option>
																							</c:forEach>
																						</select> 
																						
																						<select id="data_cata" name="dateCategoryId" class="col-xs-8 col-sm-2" 
																						        datatype="require" dc_select msg="选择数据分类" 
																						        style="margin-left: 20px;">
																							<option value="">-请选择数据分类-</option>
																						</select> 
																						
																						<span class="lbl">&nbsp;</span> 
																					</span>
																				</div>
																			</div>
																			<div class="profile-info-row" style="height: 45px;">
																				<div class="profile-info-name" style="padding-top: 15px;">选择数据源映射</div>
																				<div class="profile-info-value">
																					<span class="editable"> 
																					<select id="ds_mapping" name="mpId" class="col-xs-8 col-sm-2" datatype="require" msg="选择数据源映射" >
																							<option value="">-请选择数据源映射	-</option>
																							<c:forEach var="ds_mapping" items="${ds_mappings}">
																								<option value="${ds_mapping.id}" mptype="${ds_mapping.mappingType}">${ds_mapping.mappingName}</option>
																							</c:forEach>
																					</select>
																					<span class="lbl">&nbsp;</span> </span>
																				</div>
																			</div>
																		</div>
																	</div>
																</div>
															</div>
														</div>
													</div>
												</div>
											</div>
										</div>
										
										<div class="widget-box transparent">
											<div class="widget-header">
												<h6 class="lighter blue">数据抽取配置</h6>

											</div>
											
											<br>
											
											<div class="row" id="conf_1" >
												<div class="col-xs-12" id="table_select_list">
													<div class="col-md-3">       
												           <h4><span class="unselected-title" id="source_title" style="font-size: small;">源端数据对象列表（共0个对象）</span></h4>       

												           
												           <select id="source" class="unselected form-control dual_select" table_select style="height: 400px; width: 100%;" multiple="multiple">
													      
													       </select>  
										             </div>
										             
										             <div class="col-md-1 text-center" style="margin-top: 180px; text-align: center;">
											              <button type="button" id="btnAllRight" class="btn btn-white col-md-8 col-md-offset-2" style="margin-bottom: 10px; margin-left: 10px;" disabled="">>></button><br>
											              <button type="button" id="btnRight" class="btn btn-white col-md-8 col-md-offset-2" style="margin-bottom: 10px; margin-left: 10px;" disabled="">></button><br>
											              <button type="button" id="btnLeft" class="btn btn-white col-md-8 col-md-offset-2" style="margin-bottom: 10px; margin-left: 10px;" disabled=""> < </button><br>
											              <!-- <button type="button" id="select_finish_btn" class="btn btn-white col-md-8 col-md-offset-2" style="margin-bottom: 10px; margin-left: 30px;" disabled="" onclick='finishSelect();'> 完成 </button> -->
											              <button type="button" id="btnAllLeft" class="btn btn-white col-md-8 col-md-offset-2" style="margin-bottom: 10px; margin-left: 10px;" disabled=""> << </button><br>
											         </div>  
											         
											         <div class="col-md-8" style="margin-top:-3px;">
											         	
											         	<h4><span class="unselected-title" id="dest_title" style="font-size: small;">已选择抽取对象列表（共0个对象）</span></h4> 
											         
											         	<div style=" border:1px solid #d5d5d5;">
											         	<div class="wrapper" style="height:400px; overflow-y:scroll;">
												     	<table class="scroll table table-striped table-bordered table-hover" style="margin-bottom:0px;">
															<thead>
																<tr>
																	<th class="center" width="5%">
																		<label>
																		<input type="checkbox" onclick="changeDestination(this)" class="ace" id="checkedAll"/>
																		<span class="lbl"></span>
																		</label>
																	</th>
																	<th class="center" width="25%">已选择表</th>
																	<th class="center" width="15%">schema</th>
																	<th class="center" width="13%">有增量字段</th>	
																	<th class="center" width="13%">字段信息</th>
																	<th class="center" width="13%">抽取区间</th>
																	<th class="center" width="16%">自定义过滤条件</th>
																</tr>
															</thead>
														
															<tbody id="table_table_body">
															</tbody>
														</table>
														</div>
														</div>
											         </div> 
												</div>
												
												<div style="display:none">
													<h4><span class="selected-title">已选表</span></h4>       
												    <input id="filter_destination" class="filter form-control filter-selected" type="text" placeholder="请输入查询条件..." style="margin-bottom: 5px;">       
												    <select id="destination" class="selected form-control dual_select" style="height: 200px; width: 100%;" multiple="multiple" name="">
												    </select>
												</div>
									    	</div>
                                            <div class="row" id="conf_3" style="display: none;">
                                                <div class="table-responsive">
                                                    <div class="row">
                                                        <div class="col-xs-12">
                                                            <div class="widget-main">
                                                                <div class="profile-user-info profile-user-info-striped">
                                                                    <div class="profile-info-row">
                                                                        <div class="profile-info-name">目录过滤条件</div>
                                                                        <div class="profile-info-value">
																		<span class="editable">
																			<input  type="checkbox" class="ace"  name="chlidDir" id="sendChlidDir" value="1"/>
																			<span class="lbl"> 发送子目录</span>
																		</span>
                                                                        </div>
                                                                    </div>
                                                                    <div class="profile-info-row">
                                                                        <div class="profile-info-name">文件过滤条件</div>
                                                                        <div class="profile-info-value">
																		<span class="editable">
																			<div class="profile-info-row">
																				<div class="profile-info-name">文件名</div>
																				<div class="profile-info-value">
																					<input name="filterType"  id="filterType1" type="radio" class="ace" value="1" checked="checked" style="margin-top:10px;"/>
																					<span class="lbl">&nbsp;通配符</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
																					<input type="text" name="filterValue1" id="filterValue1"  title="通配符" placeholder="通配符" maxlength="150"/>
																					<span class="tipMe" title="星号(*)代表任意个数的字符串，问号(?)代表一个字符.当查找文件夹时，可以使用它来代替一个或多个真正字符；当不知道真正字符或者懒得输入完整名字时，可使用通配符代替一个或多个真正的字符。例：'*.txt'查找所有扩展名为.txt的文件；'abc?.txt'查找以abc开头的一个字符结尾，并扩展名为.txt的文件。"><a>帮助</a></span>
																				</div>
																				<div class="profile-info-value">
																					<input  name="filterType"  id="filterType2"  type="radio" class="ace" value="2"  style="margin-top:10px;"/>
																					<span class="lbl">&nbsp;正则表达式</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
																					<input type="text" name="filterValue2" id="filterValue2" title="正则表达式" placeholder="正则表达式" maxlength="150" />
																					<span  class="tipMe" title="使用正则表达式过滤文件,例如：查找文件名以时间戳yyyyMMddHHmmss结尾的txt文件，则正则表达式为【\d{14}\.txt】"><a>帮助</a></span>
																				</div>
																				<input type="hidden" name="filterValue" id="filterValue" />
																			</div>
																			<div class="profile-info-row">
																				<div class="profile-info-name">文件大小</div>
																				<div class="profile-info-value">
																					<span class="lbl">最小</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
																					<input type="text" name="sizeMin"  id="sizeMin" value="0" style="width: 100px;"/>
																					<span class="lbl">KB</span>
																				</div>
																				<div class="profile-info-value">
																					 <span class="lbl">最大</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
																						<input name="maxType"  id="maxType1" type="radio" class="ace"  value="1" checked="checked"  style="margin-top:10px;"/>
																						<span class="lbl">&nbsp;无限制</span>&nbsp;&nbsp;&nbsp;
																						<input name="maxType"   id="maxType2" type="radio" class="ace" value="2"  style="margin-top:10px;"/>
																						<span class="lbl">&nbsp;指定最大值&nbsp;</span>
																						<input type="text" name="sizeMax" id="sizeMax" value="0" style="width: 100px;"/>
																						<span class="lbl">KB</span>
																				</div>
																			</div>
																		</span>
                                                                        </div>
                                                                    </div>
                                                                    <!--
                                                                    <div class="profile-info-row">
                                                                        <div class="profile-info-name"></div>
                                                                        <div class="profile-info-value">
                                                                            <span class="editable">
                                                                                <input name="sameDirPath"  id="sameDirPath" type="checkbox" class="ace"  value="1"/>
                                                                                <span class="lbl"> 文件到达目的目录后，保持子目录结构？</span>
                                                                            </span>
                                                                        </div>
                                                                    </div>
                                                                     -->
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
										</div>



										<div class="widget-box transparent">
											<div class="widget-header">
												<h6 class="lighter blue">任务首次执行类型</h6>
											</div>
											
											<div class="widget-body">
												<div class="widget-main no-padding-left no-padding-right">
													<div class="row">
														<div class="table-responsive">
															<div class="row">
																<div class="col-xs-12">
																	<div class="row" style="margin-left:20px; margin-bottom:4px;">
																	<input  name="taskFreqType" id="taskFreqType2" type="hidden" value="${taskType}"/>
																
																	<input name="executeType" id="executeType1" type="radio"  class="ace"  value="1"  checked="checked"  style="margin-top:12px;" onclick="changeExecuteType();"/>
																	<span class="lbl">&nbsp;立即执行</span>&nbsp;&nbsp;
																				
																	<input name="executeType" id="executeType2" type="radio"  class="ace"  value="2"  style="margin-top:12px;" onclick="changeExecuteType();"/>
																	<span class="lbl">&nbsp;手动执行</span> &nbsp;&nbsp;
																						
																	<input name="executeType" id="executeType3" type="radio"  class="ace"  value="3"  style="margin-top:12px;" onclick="changeExecuteType();"/>								
																	<span class="lbl">&nbsp;定时执行</span> &nbsp;
																	<input type="text" name="ontimeExecuteTime" id="ontimeExecuteTime"  title="定时发送时间" placeholder="定时发送时间"  style="width: 185px;margin-left: 10px;" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
																	</div>
																	
																	
																	
																</div>
															</div>
														</div>
													</div>
												</div>
											</div>
										</div>
										
										
										<div class="widget-box transparent" id="freq_div">
											<div class="widget-header">
												<h6 class="lighter blue">任务执行频率</h6>
											</div>
											
											<div class="widget-body">
												<div class="widget-main no-padding-left no-padding-right">
													
													<div class="row">
														<div class="table-responsive">
															<div class="row">
																<div class="col-xs-12">
																
																							<div class="profile-info-value" style="margin-left:14px; margin-bottom:4px;border-top:0;">
																								<input name="intervalVallue" id="intervalVallue" type="hidden" value="">
																								<input name="periodExecuteTime" id="periodExecuteTime" type="hidden" value="">
																								<input name="freq" id="freq1" type="radio" value="1"  class="ace"   checked="checked" style="margin-top:10px;"/>
																								<span class="lbl">&nbsp;间隔</span>&nbsp;&nbsp;
																								<input type="text" style="height:30px;width: 40px;padding-top: 2px;" name="intervalVallue1" id="intervalVallue1" value="" title="间隔时间"/> 
																								<select name="intervalVallue1Type" id="intervalVallue1Type">
																									<option value="1">秒</option>
																									<option value="60">分钟</option>
																									<option value="3600">小时</option>
																								</select>&nbsp;&nbsp;<span id="settSpan" >
                                                                                                <input name="isSett" id="isSett" type="checkbox"  class="ace"  value="1" style="margin-top:12px;" onclick="checkIsSett();"/>
                                                                                                <span class="lbl">&nbsp;是否结算</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：所有交换表增量字段必须为日期类型.</span>																</div>
																							<div class="profile-info-value" style="margin-left:14px;">
																								<input  name="freq" id="freq2"  type="radio"  class="ace"  value="2" style="margin-top:10px;"/>
																								<span class="lbl">&nbsp;每天</span>&nbsp;&nbsp;
																								<input type="text" style="width: 185px;height:30px;padding-top: 2px;" id="executeTime2"  title="任务执行时间" placeholder="执行时间"   name="executeTime2" onfocus="WdatePicker({dateFmt:'HH:mm:ss'})" />
																							</div>
																							<div class="profile-info-value" style="margin-left:14px;">
																								<input  name="freq" id="freq3"  type="radio"   class="ace"  value="3" style="margin-top:10px;"/>
																								<span class="lbl">&nbsp;每周</span>&nbsp;&nbsp;
																								<select name="intervalVallue3" id="intervalVallue3">
																									<option value="2">周一</option>
																									<option value="3">周二</option>
																									<option value="4">周三</option>
																									<option value="5">周四</option>
																									<option value="6">周五</option>
																									<option value="7">周六</option>
																									<option value="1">周日</option>
																								</select>&nbsp;
																								<input type="text" style="width: 185px;height:30px;padding-top: 2px;" id="executeTime3" title="任务执行时间" placeholder="执行时间"   name="executeTime3" onfocus="WdatePicker({dateFmt:'HH:mm:ss'})" />
																							</div>
																							<div class="profile-info-value" style="margin-left:14px;">
																								<input  name="freq" id="freq4"  type="radio"  class="ace" value="4" style="margin-top:10px;"/>
																								<span class="lbl">&nbsp;每月</span> &nbsp;
																								<select style="width: 60px;" name="intervalVallue4" id="intervalVallue4">
																									<option value="1">1</option>
																									<option value="2">2</option>
																									<option value="3">3</option>
																									<option value="4">4</option>
																									<option value="5">5</option>
																									<option value="6">6</option>
																									<option value="7">7</option>
																									<option value="8">8</option>
																									<option value="9">9</option>
																									<option value="10">10</option>
																									<option value="11">11</option>
																									<option value="12">12</option>
																									<option value="13">13</option>
																									<option value="14">14</option>
																									<option selected value="15">15</option>
																									<option value="16">16</option>
																									<option value="17">17</option>
																									<option value="18">18</option>
																									<option value="19">19</option>
																									<option value="20">20</option>
																									<option value="21">21</option>
																									<option value="22">22</option>
																									<option value="23">23</option>
																									<option value="24">24</option>
																									<option value="25">25</option>
																									<option value="26">26</option>
																									<option value="27">27</option>
																									<option value="28">28</option>
																									<option value="29">29</option>
																									<option value="30">30</option>
																									<option value="31">31</option>
																								</select>&nbsp;
																								<input type="text" style="width: 185px;height:30px;padding-top: 2px;" id="executeTime4"  title="任务执行时间" placeholder="执行时间"  name="executeTime4" onfocus="WdatePicker({dateFmt:'HH:mm:ss'})" />
																							</div>
																							
																								<!-- <div class="profile-info-name" style="padding-top:12px;">截止时间</div> -->
																							<div class="profile-info-value" style="margin-left:14px;">
																								<span class="editable"> 
																									<input name="cutOffTimeType" id="cutOffTimeType1" type="radio" value="1"   class="ace"  checked="checked"  onclick="changeCutOffTimeType(1);" style="margin-top:10px;"/>
																									<span class="lbl">&nbsp;无限制</span> 
																									<input name="cutOffTimeType" id="cutOffTimeType2" type="radio" value="2"  class="ace"  onclick="changeCutOffTimeType(2);" style="margin-top:10px;"/>
																									<span class="lbl">&nbsp;指定截止时间</span> &nbsp;
																									<input type="text" name="cutOffTime" id="cutOffTime"  title="截止时间" placeholder="截止时间"   style="width: 185px;height:30px;padding-top: 2px;" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
																								</span>
																							</div>
																						</div>
																					</span>
																				</span>
																			</div>
																		</div>
																	</div>
																</div>
															</div>
														</div>
													</div>
												</div>
											</div>
										</div>
										<hr>
										<div class="clearfix form-group">
											<div class="col-md-offset-5 col-md-7">
												<button id="sbmBtn" type="submit" class="btn btn-sm btn-info"   
													id="sbmBtn">
													<i class="icon-ok bigger-110"></i>保存
												</button>
											</div>
										</div>						
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<div id="tempDiv" style="display: none;">
		<div class="modal-dialog modal-lg" style="width: 1200px;">
			<div class="modal-content" id="tableDiv">
			</div>
		</div>
	</div>
	
	<div id="WhereShowDiv" style="display: none;">
		<div class="modal-dialog modal-sm">
			<div class="modal-content" id="tableDiv_1">
			
				<div class="modal-body overflow-visible">
					<table class='table table-striped table-bordered table-hover'>
						<thead>
							<tr>
								<th>发布条件</th>
						    </tr>
						</thead>
						<tbody>
							<tr>
								<td id="WhereCell">
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="modal-footer">
          			<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        		</div>
				
			</div>
		</div>
	</div>
	
	<div id="WhereEditDiv" style="display: none;">
		<div class="modal-dialog modal-sm">
			<div class="modal-content" id="tableDiv_2">
				
			</div>
		</div>
	</div>
	
	<div id="IntervalEditDiv" style="display: none;">
		<div class="modal-dialog modal-sm">
			<div class="modal-content" id="tableDiv_4">
				
			</div>
		</div>
	</div>
	
	<div id="IntervalShowDiv" style="display: none;">
		<div class="modal-dialog modal-xs">
			<div class="modal-content" id="tableDiv_5">
			
				<div class="modal-body overflow-visible">
					<table class='table table-striped table-bordered table-hover'>
						<thead>
							<tr>
								<th>数据抽取起始值</th>
							</tr>
						</thead>
						<tbody> 
							<tr>
								<td id="StartValueCell">
								</td>
							</tr>
						</tbody>
					</table>
					<table id="endValueTable" class='table table-striped table-bordered table-hover'>
						<thead>
							<tr>
								<th>数据抽取截止值</th>
							</tr>
						</thead>
						<tbody> 
							<tr>
								<td id="EndValueCell">
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="modal-footer">
          			<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        		</div>
			</div>
		</div>
	</div>
	
	<div id="selectModalDiv" style="display: none;">
		<div class="modal-dialog modal-sm" style="width: 1200px;">
			<div class="modal-content" id="tableDiv_3">
				
			</div>
		</div>
	</div>
</body>
</html>
